<%-- 
    Document   : lookup
    Created on : Aug 28, 2011, 7:20:03 PM
    Author     : krisada
--%>

<%@page import="limousine.vo.Users"%>
<%@page import="limousine.util.Token"%>
<%@page import="org.jsrpc.bridge.Key"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/jsrpc.tld" prefix="jsrpc"%>
<%@taglib uri="/WEB-INF/workforce.tld" prefix="work"%>
<!DOCTYPE html>

<% Users user = (Users) session.getAttribute(Token.USER_SESSION);
    if (user == null) {
        System.out.println("--SESSION EXPIRE--");
    }
%>

<jsrpc:broker>
    <jsrpc:register id="service" bean="workforce.limousine.service.LookupManager"/>
    <script language="JavaScript" type="text/javascript" src="js/lookup.js"></script>

    <script language="JavaScript" type="text/javascript" src="js/ui.js"></script>    
    <script language="JavaScript" type="text/javascript" src="js/table.js"></script>
    <script language="JavaScript" type="text/javascript" src="js/JTable.js"></script>
    <script language="JavaScript" type="text/javascript" src="js/util.js"></script>
    <script language="JavaScript" type="text/javascript" src="js/validation.js"></script>

</jsrpc:broker>

<script language="JavaScript" type="text/javascript" src="jsrpc.js"></script>

<script language="JavaScript" type="text/javascript">
    <!--
    function initPage() {
    <%
        //String s = this.
        String s = request.getServletPath();
        System.out.println("login.jsp[" + s + "]");
        String sp[] = s.split("/");
        System.out.println("size:" + sp.length);
        StringBuffer sf = new StringBuffer();
        /*for (int i = 2; i < sp.length; i++) {
        //System.out.println("["+ sp[i]+"]");
        sf.append("../");
        }*/
        //this.getServletContext().setAttribute(name, object);
        String pageId = (String) pageContext.getAttribute(Key.PAGE_ID);
        session.setAttribute("BACK_PATH." + pageId, sf.toString());
        sf.append(request.getScheme());
        sf.append("://");
        sf.append(request.getServerName());
        sf.append(":");
        sf.append(request.getServerPort());
        sf.append(request.getContextPath());
        sf.append("/BROKER-REGISTER?pageId=").append(pageId);
        System.out.println("path[" + sf.toString() + "]");
    %>
            initBroker("<%=sf.toString()%>");
            formSearch();
            
        }
        //-->
</script>

<body onload="initPage()">

    <div class="data_form" >
        <div class="head_data_form">
        </div>

        <div class="show_form">

            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                <tr>
                    <td><strong>Lookup</strong></td>
                </tr>
                <tr>
                    <td align="center">


                        <form action="/" id="actionForm" name="actionForm">
                            <div id="panel" style="visibility: visible"></div>

                            <fieldset class="fieldsetForm" ><legend><strong id="fieldSetLabel" >Lookup Search</strong></legend>
                                <jsp:include page="sys_msg.jsp" />

                                <div id="formSearch" style="visibility: hidden; position: absolute; ">
                                    <table width="100%" border="0" align="center">
                                        <tr><td align="right" width="35%"><work:label text="Lookup Name"/></td>
                                            <td>
                                                <work:text id="lookupNameSearch" tooltipText="Name of Lookup use<br> Separate in group id."/>         
                                            </td>
                                        </tr>
                                        <tr><td align="right"><work:label text="Lookup Group"/></td>
                                            <td>
                                                <work:text id="lookupGroupSearch" tooltipText="Name of Lookup use<br> Separate in group id."/>         
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2" align="center">
                                                <work:button id="bSearch" label="Search" onclick="searchLookup(0);"/>
                                                <work:button id="bAdd" label="Add New" onclick="setInsert()"/>
                                            </td>
                                        </tr>                                        
                                    </table>
                                    <br>
                                    <div class="divTableData">
                                        <table id="tableData" width="100%" height="100%" border="0" align="center" >
                                            <thead id="tableDataHeader">
                                            </thead>
                                            <tbody id="tableDataBody" >
                                            </tbody>
                                            <tfoot id="tableDataFooter"></tfoot>
                                        </table>
                                    </div>
                                </div>
                                <div id="formEntry" style="visibility: hidden; position: relative;">
                                    <table width="100%" border="0">
                                        <work:field-hidden id="tableId" name="tableId"/>
                                        <tr><td align="right" width="35%"><work:label text="Lookup ID"/></td>
                                            <td><work:field-id id="lookupId" name="lookupId" label="ID"/></td>
                                        </tr>
                                        <tr><td align="right"><work:label text="Name"/></td>
                                            <td><work:text id="lookupName" tooltipText="<nobr>Name of Lookup use Separate in group id.</nobr>"/></td>
                                        </tr>
                                        <tr><td align="right"><work:label text="Value"/></td>
                                            <td><work:text id="lookupValue" tooltipText="Value of Lookup use<br> Separate in group id."/></td>
                                        </tr>
                                        <tr><td align="right"><work:label text="Description" /></td>
                                            <td><work:textbox id="lookupDescription"  cols="30" rows="4" tooltipText="Description of Lookup use Separate in group id."/></td>
                                        </tr>
                                        <tr><td align="right"><work:label text="Group ID"/></td>
                                            <td><work:text id="groupId"  tooltipText="Group name of Lookup use Separate in group id."/></td>
                                        </tr>
                                        <tr><td align="right"><work:label text="Order ID" /></td>
                                            <td><work:text id="orderId"  size="3" tooltipText="Order of Lookup use Separate in group id."/></td>
                                        </tr>
                                        <tr>                          
                                            <td colspan="2" align="center">
                                                <work:button id="save" label="Save" onclick="insert()"/>&nbsp;
                                                <work:button id="list" label="Search" onclick="formSearch()"/>
                                            </td>
                                        </tr>
                                        <tr height="20">
                                            <td align="right" colspan="2"></td>
                                        </tr>
                                    </table>
                                </div>  
                            </fieldset>

                        </form>
                    </td>
                </tr>
            </table>

        </div>

        <div class="bottom_data_form">
        </div>

    </div>
</body>
